package com.service.lyxmservice.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.service.lyxmservice.model.User;

@Mapper
public interface UserDao {
	@Select("select * from t_user where name = #{name}")
	public List<User> findUser(@Param("name")String name);
	
	@SelectProvider(type = UserDao_select.class, method = "findUserById")
	public List<User> findUser1(Map<String,Object> map);
	
	class UserDao_select{
		 public String findUserById(Map<String,Object> map) {  
	            String sql = "SELECT * FROM t_user";  
	            if(map.get("name")!=null&&!map.get("name").equals("")){  
	                sql += " where id = #{id}";  
	            }  
	            return sql;  
	        }  
	}
	@Insert("insert into t_user(name,telephone) values (#{name},#{telephone})")
	public int testInsert(@Param("name")String name
			,@Param("telephone")String telephone);
	
	
}
